<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<title>POS收单运营管理平台</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<link href="<s:url value="/css/a.css"/>" type="text/css"
			rel="stylesheet" />
		<link href="<s:url value="/css/index.css"/>" type="text/css"
			rel="stylesheet" />

		<script type="text/javascript"
			src="<c:url value="/js/jquery-1.3.2.js" />"></script>
		<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
		<script language="javascript" type="text/javascript"
			src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
		<script type="text/javascript" src="/js/jquery-1.9.1.js"></script>
		<script type="text/javascript" src="/js/tabcontrol/TabPanel.js"></script>

		<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　






　　　
</style>

		<script type="text/javascript">
function addpanel(id,title,html) {
				window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
			}
			
			
	$(document).ready(
			function() {
				$("#sub").click(function(){ 
    		 var  is= subForm();  
    		 if(is){
    		    $("#queryUserForm").attr("action","<%=basePath%>/setting/settingsearch.ct");
    			$("#queryUserForm").submit();
    		 }

            });
			});
function   str2date(str){   
  var   d=null;   
  var   reg=/^(\d{4})(\d{2})(\d{2})$/  ;
  if(arr=str.match(reg))d=new   Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
  return   d;   
  }  
function  subForm(){
		var endTime = $("#maxDate").val();
		 var beginTime = $("#minDate").val();
		var setDate =$("#setDate").val();
		
		if(setDate!=''){
		   return true;
		   
		}else{
		
		if(endTime=='' || beginTime==''){
			alert("起始时间范围必须选择!");
			return false;
		} 
		  var date1=str2date(beginTime);
		  var date2=str2date(endTime);
			if(date1.getMonth()!=date2.getMonth()){
			    alert("选择的起始时间不在同一个月内！");
				return false;
			}
		}	
		return true;
}	

$(document).ready(function() {
	$("#szPower").click(function() {
				
				var start=$("#minDate").val();
				if(start==""){ alert("请选择交易起始日期！");
				return;
				}
				var end =$("#maxDate").val();
			if(end=="") {
				alert("请选择交易截止日期！");
				return;
				}
				if( end.length>0 & start.length>0){
					$("#queryUserForm").attr("action","<%=basePath%>/settingExcel/settingExcelqQuery.ct");
					$("#queryUserForm").submit();
				}	
	});						
});			


</script>



	</head>

	<body>

		<div class="subpage">
			<s:form id="queryUserForm" action="/setting/settingsearch.ct"
				method="post" theme="simple">
				<div class="user_title">
					<h2 class="headline-inquires">
						POS收单运营管理平台
						<br />
						<span class="sub-title"></span>
					</h2>
				</div>
				<table width="100%" cellpadding="0" cellspacing="0" border="0"
					class="query_table">

					<tr>
						<td colspan="4" align="center">
							<h2 class="headline-inquires">
								结算查询
								<br />
								<span class="sub-title"></span>
							</h2>

						</td>
					</tr>


					<tr>
						<td colspan="4">
							&nbsp;
						</td>
					</tr>


					


					<tr>
						<td align="right">
							结算起始日期：
						</td>
						<td align="left" colspan="1">
							<s:textfield id="minDate" name="searchCondition.minDate"
								onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
								theme="simple" cssClass="queryWidth" />
							 至 
							<s:textfield id="maxDate" name="searchCondition.maxDate"
								onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
								theme="simple" cssClass="queryWidth" />
							<font color="red">*</font>
						</td>
						<td align="right">
							出款时间：
						</td>
						<td align="left" colspan="1">
							<s:textfield id="setDate" name="searchCondition.setDate"
								onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"
								theme="simple" cssClass="queryWidth" />
							<font color="red"></font>
						</td>
					</tr>
					<tr>
					<td align="right">结算银行账号：</td>
					<td align="left" colspan="1"><s:textfield id="accountNo"
							name="searchCondition.accountNo" cssClass="queryWidth" /></td>
					<td align="right">结算银行账号名：</td>
					<td align="left" colspan="1"><s:textfield id="accountName"
							name="searchCondition.accountName" cssClass="queryWidth" /></td>
				</tr>
					<tr>
						<td align="right">
							商户号：
						</td>
						<td align="left" colspan="1">
							<s:textfield id="settFlag" name="searchCondition.merNo"
								cssClass="queryWidth" />
						</td>
						<td align="right">
							商户姓名：
						</td>
						<td align="left" colspan="1">
							<s:textfield id="realName" name="searchCondition.realName"
								cssClass="queryWidth" />
						</td>
					</tr>
					<tr>
						<td align="right">
							结算状态：
						</td>
						<td abbr="left">
							<s:select cssClass="queryWidth" name="searchCondition.settFlag"
								id="settFlag"
								list="#{'Y':'待审核','W':'待出款','H':'调单处理成功','D':'出款中','S':'出款成功','F':'出款失败'}"
								headerKey="" headerValue="--请选择--" />
							<!--
						   list="#request.settingflagList" listKey="settingFlageId" 
						   listValue="settingFlagName" />-->

						</td>
						<td align="right">
							冻结状态：
						</td>
						<td abbr="left">
							<s:select cssClass="queryWidth" name="searchCondition.frozenFlag"
								id="frozenFlag" list="#{'N':'未冻结','Y':'已冻结'}" headerKey=""
								headerValue="--请选择--" />

						</td>


					</tr>
					
					<tr>
						<td colspan="4">
							&nbsp;
						</td>
					</tr>
					<tr>
						<td colspan="4" align="center">
							<span style="font-color: red"><s:actionerror /> </span>
							<span style="font-color: red;"><s:actionmessage /> </span>
							<span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /> </span>
							<span id="otherError"></span>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="right">
							<input id="sub" value="查   询" type="button" />
							&nbsp;&nbsp;&nbsp;&nbsp;
							<s:reset value="取  消" />
							&nbsp;&nbsp;&nbsp;&nbsp;
						</td>
					</tr>
					<tr>
						<td colspan="4" align="right">
							<s:if
								test="#request.searchRsList != null && #request.searchRsList.size>0">
								<input id="szPower" type="button" value="导出Excel" />&nbsp;&nbsp;&nbsp;&nbsp;
					   
					</s:if>
							<s:else>
								<input id="szPower" disabled="disabled" value="导出Excel"
									type="button" /> &nbsp;&nbsp;&nbsp;&nbsp;
					</s:else>
						</td>
					</tr>
				</table>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">

					<tr>
						<td colspan="4" align="center">
							<h2 class="headline-inquires">
								结算信息列表
							</h2>
						</td>
					</tr>
					<s:if
						test="#request.searchRsList != null && #request.searchRsList.size>0">
						<tr>
							<td align="left">
								&nbsp;&nbsp;&nbsp;&nbsp;
								<page:pageCount max_pages="11"
									totalPage="${requestScope.totalPage}"
									currentPage="${requestScope.currentPage}"
									action="${rootPath}/setting/settingsearch.ct?currentPage=" />

							</td>
						</tr>
					</s:if>
				</table>
				<table id="tableList" width="100%" class="table">
					<thead>
						<tr>
							<th>
								商户号
							</th>
							<th>
								商户名称
							</th>
							<th>
								结算日期
							</th>
							<th>
								出款日期
							</th>
							<th>
								总金额（元）
							</th>
							<th>
								总笔数
							</th>
							<th>
								商户手续费（元）
							</th>
							<th>
								结算金额（元）
							</th>
							<th>
								结算状态
							</th>
							<th>
								冻结状态
							</th>
							<th>
								结算银行
							</th>
							<th>
								账号名称
							</th>
							<th>
								银行账号
							</th>
							<th>
								结算批次
							</th>
							<th>
								详细信息
							</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="#request.settingList" status="stat" id="sett">
							<tr class="<s:if test="#stat.index%2==0">tr_0</s:if>">
								
								<td>
									 
										<s:property value="#sett.merchantno" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.merchantname" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.settledate" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.setdate" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.totalamt" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.totalnum" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.merchantfee" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.merchantsettleamt" />
									 
								</td>
								<td>
									 
										<s:if test="#sett.settleflag==\"Y\"">
					                          待审核
					        </s:if>
										<s:elseif test="#sett.settleflag==\"W\"">
					                             待出款
					        </s:elseif>
					        <s:elseif test="#sett.settleflag==\"H\"">
					                          调单处理成功
					        </s:elseif>
										<s:elseif test="#sett.settleflag==\"D\"">
					                            出款中
					        </s:elseif>
										<s:elseif test="#sett.settleflag==\"S\"">
					                           出款成功
					        </s:elseif>
										<s:else>
					                           出款失败
					        </s:else>

									 
								</td>
								<td>
									 
										<s:if test="#sett.freezeflag==\"Y\"">
					                       已冻结
					        			</s:if>
										 <s:elseif test="#sett.freezeflag==\"Q\"">
					                       冻结申请
					        			</s:elseif>
										<s:else>
					                          未冻结
					        			</s:else>

									 
								</td>
								<td>
									 
										<s:property value="#sett.bankdeposit" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.accountname" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.accountno" />
									 
								</td>
								<td>
									 
										<s:property value="#sett.batchno" />
									 
								</td>
								<td>
									<s:a
										href="javascript:addpanel('','结算详细列表','/fmposm/setting/calcudetailsearch.ct?merchantno=%{#sett.merchantno}&batchno=%{#sett.orderno}')">详情</s:a>
								</td>

							</tr>
						</s:iterator>
					</tbody>
				</table>
			</s:form>
		</div>
		<s:if test="#request.msg !=null">
			<script language="javascript">
			alert("${request.msg}");
		</script>
		</s:if>
	</body>
</html>
